package network;

public class Rule {
    private long dstIp;
    private int priority, hit, nMatch;
    private Port port;
    private Device device;

    /**
     * @param device the device that owns this rule
     * @param dstIp wildcard match of dstIp
     * @param priority the priority of rule, which is also the length of prefix in longest prefix match
     * @param port the forwarding action
     */
    public Rule(Device device, long dstIp, int priority, Port port) {
        this.device = device;
        this.dstIp = dstIp;
        this.priority = priority;
        this.port = port;
    }

    public Device getDevice() {
        return this.device;
    }

    public long getDstIp() {
        return this.dstIp;
    }

    public int getPriority() {
        return this.priority;
    }

    public Port getPort() {
        return this.port;
    }

    public int getHit() {
        return this.hit;
    }

    public void setHit(int hit) {
        this.hit = hit;
    }

    public int getNMatch() {
        return this.nMatch;
    }

    public void setNMatch(int nMatch) {
        this.nMatch = nMatch;
    }
}